package by.msokoloff.javaweb2015.webapp.page;

import org.apache.wicket.markup.html.panel.Panel;

import by.msokoloff.javaweb2015.datamodel.AbstractEntity;
import by.msokoloff.javaweb2015.datamodel.AdmUser;
import by.msokoloff.javaweb2015.datamodel.Airport;
import by.msokoloff.javaweb2015.datamodel.City;
import by.msokoloff.javaweb2015.datamodel.Country;
import by.msokoloff.javaweb2015.datamodel.Extra;
import by.msokoloff.javaweb2015.datamodel.Flight;
import by.msokoloff.javaweb2015.datamodel.Plane;
import by.msokoloff.javaweb2015.datamodel.PlaneModel;
import by.msokoloff.javaweb2015.datamodel.Registration;
import by.msokoloff.javaweb2015.datamodel.TripOrder;
import by.msokoloff.javaweb2015.webapp.page.admuser.AdmUserListPanel;
import by.msokoloff.javaweb2015.webapp.page.airport.AirportListPanel;
import by.msokoloff.javaweb2015.webapp.page.city.CityListPanel;
import by.msokoloff.javaweb2015.webapp.page.country.CountryListPanel;
import by.msokoloff.javaweb2015.webapp.page.extra.ExtraListPanel;
import by.msokoloff.javaweb2015.webapp.page.flight.FlightListPanel;
import by.msokoloff.javaweb2015.webapp.page.layout.AdminLayout;
import by.msokoloff.javaweb2015.webapp.page.plane.PlaneListPanel;
import by.msokoloff.javaweb2015.webapp.page.planemodel.PlaneModelListPanel;
import by.msokoloff.javaweb2015.webapp.page.registration.RegistrationListPanel;
import by.msokoloff.javaweb2015.webapp.page.triporder.TripOrderListPanel;

public class EntityListPage extends AdminLayout {
	
	private Panel listPanel;
	
	public EntityListPage(Class<? extends AbstractEntity> c) {
		if (c == Country.class) {
			listPanel = new CountryListPanel("listpanel");
		} else if (c == City.class) {
			listPanel = new CityListPanel("listpanel");
		} else if (c == Airport.class) {
			listPanel = new AirportListPanel("listpanel");
		} else if (c == PlaneModel.class) {
			listPanel = new PlaneModelListPanel("listpanel");
		} else if (c == Plane.class) {
			listPanel = new PlaneListPanel("listpanel");
		} else if (c == Flight.class) {
			listPanel = new FlightListPanel("listpanel");
		} else if (c == TripOrder.class) {
			listPanel = new TripOrderListPanel("listpanel");
		} else if (c == Registration.class) {
			listPanel = new RegistrationListPanel("listpanel");
		} else if (c == Extra.class) {
			listPanel = new ExtraListPanel("listpanel");
		} else if (c == AdmUser.class) {
			listPanel = new AdmUserListPanel("listpanel");
		} else {
			// TODO compose exception
		}
		add(listPanel);
	}

}
